(0) Obligation:

Clauses:

p(M, N, s(R), RES) :- p(M, R, N, RES).
p(M, s(N), R, RES) :- p(R, N, M, RES).
p(M, X1, X2, M).

Query: p(g,g,g,a)

(1) PrologToDTProblemTransformerProof (SOUND transformation)

Built DT problem from termination graph DT10.

(2) Obligation:

Triples:

pA(X1, s(X2), s(X3), X4) :- pA(X1, X2, X3, X4).
pA(X1, X2, s(s(X3)), X4) :- pA(X2, X3, X1, X4).
pA(X1, s(X2), s(X3), X4) :- pA(s(X3), X2, X1, X4).
pA(s(X1), s(X2), X3, X4) :- pA(X3, X1, X2, X4).
pA(X1, s(s(X2)), X3, X4) :- pA(X1, X2, X3, X4).

Clauses:

pcA(X1, s(X2), s(X3), X4) :- pcA(X1, X2, X3, X4).
pcA(X1, X2, s(s(X3)), X4) :- pcA(X2, X3, X1, X4).
pcA(X1, X2, s(X3), X1).
pcA(X1, s(X2), s(X3), X4) :- pcA(s(X3), X2, X1, X4).
pcA(X1, X2, s(X3), X1).
pcA(s(X1), s(X2), X3, X4) :- pcA(X3, X1, X2, X4).
pcA(X1, s(s(X2)), X3, X4) :- pcA(X1, X2, X3, X4).
pcA(X1, s(X2), X3, X3).
pcA(X1, s(X2), X3, X1).
pcA(X1, X2, X3, X1).

Afs:

pA(x1, x2, x3, x4)  =  pA(x1, x2, x3)

(3) TriplesToPiDPProof (SOUND transformation)

We use the technique of [DT09]. With regard to the inferred argument filtering the predicates were used in the following modes:
pA_in: (b,b,b,f)
Transforming TRIPLES into the following Term Rewriting System:
Pi DP problem:
The TRS P consists of the following rules:

PA_IN_GGGA(X1, s(X2), s(X3), X4) → U1_GGGA(X1, X2, X3, X4, pA_in_ggga(X1, X2, X3, X4))
PA_IN_GGGA(X1, s(X2), s(X3), X4) → PA_IN_GGGA(X1, X2, X3, X4)
PA_IN_GGGA(X1, X2, s(s(X3)), X4) → U2_GGGA(X1, X2, X3, X4, pA_in_ggga(X2, X3, X1, X4))
PA_IN_GGGA(X1, X2, s(s(X3)), X4) → PA_IN_GGGA(X2, X3, X1, X4)
PA_IN_GGGA(X1, s(X2), s(X3), X4) → U3_GGGA(X1, X2, X3, X4, pA_in_ggga(s(X3), X2, X1, X4))
PA_IN_GGGA(X1, s(X2), s(X3), X4) → PA_IN_GGGA(s(X3), X2, X1, X4)
PA_IN_GGGA(s(X1), s(X2), X3, X4) → U4_GGGA(X1, X2, X3, X4, pA_in_ggga(X3, X1, X2, X4))
PA_IN_GGGA(s(X1), s(X2), X3, X4) → PA_IN_GGGA(X3, X1, X2, X4)
PA_IN_GGGA(X1, s(s(X2)), X3, X4) → U5_GGGA(X1, X2, X3, X4, pA_in_ggga(X1, X2, X3, X4))
PA_IN_GGGA(X1, s(s(X2)), X3, X4) → PA_IN_GGGA(X1, X2, X3, X4)

R is empty.
The argument filtering Pi contains the following mapping:
pA_in_ggga(x1, x2, x3, x4)  =  pA_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
PA_IN_GGGA(x1, x2, x3, x4)  =  PA_IN_GGGA(x1, x2, x3)
U1_GGGA(x1, x2, x3, x4, x5)  =  U1_GGGA(x1, x2, x3, x5)
U2_GGGA(x1, x2, x3, x4, x5)  =  U2_GGGA(x1, x2, x3, x5)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x1, x2, x3, x5)
U4_GGGA(x1, x2, x3, x4, x5)  =  U4_GGGA(x1, x2, x3, x5)
U5_GGGA(x1, x2, x3, x4, x5)  =  U5_GGGA(x1, x2, x3, x5)

We have to consider all (P,R,Pi)-chains

Infinitary Constructor Rewriting Termination of PiDP implies Termination of TRIPLES

(4) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

PA_IN_GGGA(X1, s(X2), s(X3), X4) → U1_GGGA(X1, X2, X3, X4, pA_in_ggga(X1, X2, X3, X4))
PA_IN_GGGA(X1, s(X2), s(X3), X4) → PA_IN_GGGA(X1, X2, X3, X4)
PA_IN_GGGA(X1, X2, s(s(X3)), X4) → U2_GGGA(X1, X2, X3, X4, pA_in_ggga(X2, X3, X1, X4))
PA_IN_GGGA(X1, X2, s(s(X3)), X4) → PA_IN_GGGA(X2, X3, X1, X4)
PA_IN_GGGA(X1, s(X2), s(X3), X4) → U3_GGGA(X1, X2, X3, X4, pA_in_ggga(s(X3), X2, X1, X4))
PA_IN_GGGA(X1, s(X2), s(X3), X4) → PA_IN_GGGA(s(X3), X2, X1, X4)
PA_IN_GGGA(s(X1), s(X2), X3, X4) → U4_GGGA(X1, X2, X3, X4, pA_in_ggga(X3, X1, X2, X4))
PA_IN_GGGA(s(X1), s(X2), X3, X4) → PA_IN_GGGA(X3, X1, X2, X4)
PA_IN_GGGA(X1, s(s(X2)), X3, X4) → U5_GGGA(X1, X2, X3, X4, pA_in_ggga(X1, X2, X3, X4))
PA_IN_GGGA(X1, s(s(X2)), X3, X4) → PA_IN_GGGA(X1, X2, X3, X4)

R is empty.
The argument filtering Pi contains the following mapping:
pA_in_ggga(x1, x2, x3, x4)  =  pA_in_ggga(x1, x2, x3)
s(x1)  =  s(x1)
PA_IN_GGGA(x1, x2, x3, x4)  =  PA_IN_GGGA(x1, x2, x3)
U1_GGGA(x1, x2, x3, x4, x5)  =  U1_GGGA(x1, x2, x3, x5)
U2_GGGA(x1, x2, x3, x4, x5)  =  U2_GGGA(x1, x2, x3, x5)
U3_GGGA(x1, x2, x3, x4, x5)  =  U3_GGGA(x1, x2, x3, x5)
U4_GGGA(x1, x2, x3, x4, x5)  =  U4_GGGA(x1, x2, x3, x5)
U5_GGGA(x1, x2, x3, x4, x5)  =  U5_GGGA(x1, x2, x3, x5)

We have to consider all (P,R,Pi)-chains

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 5 less nodes.

(6) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

PA_IN_GGGA(X1, X2, s(s(X3)), X4) → PA_IN_GGGA(X2, X3, X1, X4)
PA_IN_GGGA(X1, s(X2), s(X3), X4) → PA_IN_GGGA(X1, X2, X3, X4)
PA_IN_GGGA(X1, s(X2), s(X3), X4) → PA_IN_GGGA(s(X3), X2, X1, X4)
PA_IN_GGGA(s(X1), s(X2), X3, X4) → PA_IN_GGGA(X3, X1, X2, X4)
PA_IN_GGGA(X1, s(s(X2)), X3, X4) → PA_IN_GGGA(X1, X2, X3, X4)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
PA_IN_GGGA(x1, x2, x3, x4)  =  PA_IN_GGGA(x1, x2, x3)

We have to consider all (P,R,Pi)-chains

(7) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(8) Obligation:

Q DP problem:
The TRS P consists of the following rules:

PA_IN_GGGA(X1, X2, s(s(X3))) → PA_IN_GGGA(X2, X3, X1)
PA_IN_GGGA(X1, s(X2), s(X3)) → PA_IN_GGGA(X1, X2, X3)
PA_IN_GGGA(X1, s(X2), s(X3)) → PA_IN_GGGA(s(X3), X2, X1)
PA_IN_GGGA(s(X1), s(X2), X3) → PA_IN_GGGA(X3, X1, X2)
PA_IN_GGGA(X1, s(s(X2)), X3) → PA_IN_GGGA(X1, X2, X3)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(9) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • PA_IN_GGGA(X1, X2, s(s(X3))) → PA_IN_GGGA(X2, X3, X1)
    The graph contains the following edges 2 >= 1, 3 > 2, 1 >= 3

  • PA_IN_GGGA(X1, s(X2), s(X3)) → PA_IN_GGGA(X1, X2, X3)
    The graph contains the following edges 1 >= 1, 2 > 2, 3 > 3

  • PA_IN_GGGA(X1, s(X2), s(X3)) → PA_IN_GGGA(s(X3), X2, X1)
    The graph contains the following edges 3 >= 1, 2 > 2, 1 >= 3

  • PA_IN_GGGA(s(X1), s(X2), X3) → PA_IN_GGGA(X3, X1, X2)
    The graph contains the following edges 3 >= 1, 1 > 2, 2 > 3

  • PA_IN_GGGA(X1, s(s(X2)), X3) → PA_IN_GGGA(X1, X2, X3)
    The graph contains the following edges 1 >= 1, 2 > 2, 3 >= 3

(10) YES